package com.lbi.framework.collection {

	import asunit.framework.TestCase;

	public class SelectableTest extends TestCase {
		private var selectable : Selectable;
		
	
		protected override function setUp() : void {
			selectable = new Selectable();
		}


		public function testEvents() :void{
			var selected_fired : Boolean = false;
			var deselected_fired : Boolean = false;
			selectable.addEventListener(Selectable.SELECTED, function():void {
				selected_fired = true;
			});
			selectable.addEventListener(Selectable.DESELECTED, function():void {
				deselected_fired = true;
			});
			selectable.select();
			assertTrue("should have fired 'selected'",selected_fired);
			selected_fired = false;
			selectable.select(); 
			assertFalse("should not fire again if already selected",selected_fired);
			selectable.deselect();
			assertTrue(deselected_fired);
		}
		private function testStateStuff() :void{
			var default_state : Boolean = selectable.isSelected();
			assertEquals(false, default_state);
			selectable.select();
			assertEquals(true, selectable.isSelected());
		}
	}
}